<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
      <input type="text" id="arg1">
      <input type="text" id="arg2">
      <p id="res">结果:</p>
      <input type="button" value="加" onclick="add()">
      <input type="button" value="减" onclick="sub()">
      <input type="button" value="乘" onclick="mul()">
      <input type="button" value="除" onclick="div()">

      <script>
        let  add=function (){
              let argument1=document.getElementById("arg1").value;
              let argument2=document.getElementById("arg2").value;
              argument1=parseFloat(argument1)
              argument2=parseFloat(argument2)
              let result=argument1+argument2;
              console.log(result);
              let element = document.getElementById("res");
              element.innerText=result;
        }
        let  sub=function (){
              let argument1=document.getElementById("arg1").value;
              let argument2=document.getElementById("arg2").value;
              let result=argument1-argument2;
              let element = document.getElementById("res");
              element.innerText=result;
        }
        let  mul=function (){
              let argument1=document.getElementById("arg1").value;
              let argument2=document.getElementById("arg2").value;
              let result=argument1 * argument2;
              let element = document.getElementById("res");
              element.innerHTML=result;
        }
        let  div=function (){
              let argument1=document.getElementById("arg1").value;
              let argument2=document.getElementById("arg2").value;
              let result=argument1/argument2;
              let element = document.getElementById("res");
              element.innerHTML=result;
        }
      </script>
</body>
</html>